<?php
use yii\helpers\Html;
use yii\bootstrap\ActiveForm;
use yii\helpers\Url;
use backend\assets\AppAsset;
$this->title = '基础信息';

//注册css
$cssString = "input[type='file']{display: inline-block;}";  
$this->registerCss($cssString);

//注册js
AppAsset::addScriptFile($this, 'assets/js/upload-preview.js');
$jsString = '$("#indexform-logo").uploadPreview({Img: "logo-view", Width: 120, Height: 120 });$("#indexform-icon").uploadPreview({Img: "icon-view", Width: 120, Height: 120 });';
$this->registerJs($jsString);

?>
<div class="container">
    <div class="row">
        <?php echo $this->render('_leftnav') ?>
        <div class="col-md-10">
            <div class="page-header clearfix">
                <h1 class="pull-left">基础信息</h1>
                <div class="pull-right">     
            </div>
        </div>
        <?php echo $this->render('_sitesetting') ?>

        <!--站点配置表单类-->
        <?php 
            $form = ActiveForm::begin([
                'options' => ['class' => 'form-horizontal','id'=>'site-form','enctype' => 'multipart/form-data'],
                'action'=>Url::to(['system/index']),
                'method'=>'post',
                'fieldConfig' => [
                    'template' => '<div class="form-group"><div class="col-md-2 control-label">{label}</div><div class="col-md-8 controls">{input}{error}</div></div>'
                ], 
            ]);
        ?>
        <fieldset>
            <?= $form->field($model, 'sitename', ['inputOptions'=>['placeholder'=>'']])->textInput() ?>

            <?= $form->field($model, 'title', ['inputOptions'=>['placeholder'=>'']])->textInput() ?>

            <?= $form->field($model, 'url', ['inputOptions'=>['placeholder'=>''],'template'=>'<div class="form-group"><div class="col-md-2 control-label">{label}</div><div class="col-md-8 controls">{input}{error}<p class="help-block">以"http://"或"https://"开头</p></div></div>'])->textInput() ?>

            <?= $form->field($model, 'logo',['template'=>'<div class="form-group"><div class="col-md-2 control-label">{label}</div><div class="col-md-8 cont rols"><img src="'.$model->logo.'" id="logo-view" alt="站点logo" width="60px;" />  {input}{error}</div></div>'])->fileInput() ?>

            <?= $form->field($model, 'icon',['template'=>'<div class="form-group"><div class="col-md-2 control-label">{label}</div><div class="col-md-8 cont rols"><img src="'.$model->icon.'" id="icon-view" alt="站点logo" width="60px;" />  {input}{error}</div></div>'])->fileInput() ?> 

            <?= $form->field($model, 'keywords', ['inputOptions'=>['placeholder'=>'']])->textInput() ?>

            <?= $form->field($model, 'description', ['inputOptions'=>['placeholder'=>'']])->textInput() ?>

            <?= $form->field($model, 'email', ['inputOptions'=>['placeholder'=>'']])->textInput() ?>

            <?= $form->field($model, 'copyright', ['inputOptions'=>['placeholder'=>''],'template'=>'<div class="form-group"><div class="col-md-2 control-label">{label}</div><div class="col-md-8 controls">{input}<div class="help-block">您可以填写网站名称或公司名称。</div></div></div>'])->textInput() ?>

            <?= $form->field($model, 'icp', ['inputOptions'=>['placeholder'=>'']])->textInput() ?>
        </fieldset>
        <br />
        <fieldset>
            <legend>网站统计分析代码部署</legend>
            <?= $form->field($model, 'count', [
                'inputOptions'=>['placeholder'=>''],
                'template'=>'<div class="form-group"><div class="col-md-2 control-label">{label}</div><div class="col-md-8 controls">{input}<p class="help-block">建议使用下列统计分析的一种：<a href="http://www.google.cn/intl/zh-CN_ALL/analytics/" target="_blank">谷歌分析</a>、<a href="http://tongji.baidu.com/" target="_blank">百度统计</a>、<a href="http://ta.qq.com/" target="_blank">腾讯分析</a>、<a href="http://www.cnzz.com/" target="_blank">CNZZ</a>。</p></div></div>'
            ])->textarea(['rows'=>3]) ?>
        </fieldset>
    
        

        <div class="row form-group">
            <div class="controls col-md-offset-2 col-md-8">
                <?= Html::submitButton('保存', ['class' => 'btn btn-primary']) ?>

            </div>
        </div>

        <?php ActiveForm::end(); ?>

    </div>
</div>
</div>